package com.zhlb.zfba.modules.per.service;

import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zhlb.zfba.common.utils.DateUtil;
import com.zhlb.zfba.common.utils.IdGen;
import com.zhlb.zfba.modules.card.bean.CardRegInfo;
import com.zhlb.zfba.modules.card.service.CardRegInfoService;
import com.zhlb.zfba.modules.per.bean.GoodsInfo;
import com.zhlb.zfba.modules.per.bean.PoliceInfo;
import com.zhlb.zfba.modules.per.bean.RoomInfo;
import com.zhlb.zfba.modules.per.bean.SuspectInfo;
import com.zhlb.zfba.modules.per.dao.GoodsInfoDao;
import com.zhlb.zfba.modules.per.dao.PoliceInfoDao;
import com.zhlb.zfba.modules.per.dao.RoomInfoDao;
import com.zhlb.zfba.modules.per.dao.SuspectInfoDao;

@Service
@Transactional(readOnly = true)
public class RoomInfoService {
	@Autowired 
	RoomInfoDao roomInfoDao;
	public RoomInfo get(String id) {
		return roomInfoDao.get(id);
	}
	
	public RoomInfo getRoomInfo(RoomInfo roomInfo) {
		return roomInfoDao.getRoomInfo(roomInfo);
	}
	
	public List<RoomInfo> findList(RoomInfo roomInfo) {
		return roomInfoDao.findList(roomInfo);
	}

	@Transactional(readOnly = false)
	public void save(RoomInfo roomInfo) {
//		if(StringUtils.isBlank(roomInfo.getGoodsGUID())){
//			goodsInfo.setGoodsGUID(IdGen.uuid());
////			goodsInfo.setInTime(DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss"));
//			goodsInfoDao.insert(goodsInfo);
//			
//		}else{
//			GoodsInfo updateEntity=this.get(goodsInfo.getGoodsGUID());
//			//自封袋号
//			//储物柜号
//			//接收人
//			//接时间
//			//物品内容
//			goodsInfoDao.update(updateEntity);
//		 }
	}
	
	@Transactional(readOnly = false)
	public void delete(String ids) {
		String[] idArr=null;
		if(StringUtils.isNotBlank(ids)){
			idArr=ids.split(",");
			for(String id:idArr){
				roomInfoDao.delete(id);
			}
		}
		
	}
//	@Transactional(readOnly = false)
//	public void updateIsLeave(SuspectInfo suspectInfo){
//		suspectInfo.setIsLeave(1);
//		suspectInfo.setLeaveTime(DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss"));
//		//suspectInfoDao.updateIsLeaveOfSuspectInfo(suspectInfo);
//	}
}
